<?php defined('SYSPATH') or die('No direct script access.');

class Request extends Kohana_Request {
  function uri2(array $params = NULL)
  {
    $r = Request::current();
    
    if ( ! isset($params['directory']))
    {
      // Add the current directory
      $params['directory'] = $r->directory();
    }

    if ( ! isset($params['controller']))
    {
      // Add the current controller
      $params['controller'] = $r->controller();
    }

    if ( ! isset($params['action']))
    {
      // Add the current action
      $params['action'] = $r->action();
    }

    // Add the current parameters
    $params += $this->_params;

    return $r->route()->uri($params);
  }
}
